home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / td.h < prev    next >
C/C++ Source or Header  |  1990-09-11  |  4KB  |  131 lines

  1. /*
  2.  * td.h --
  3.  *
  4.  *    Declarations of externally-visible things provided by the
  5.  *    terminal driver library.  This includes both the basic tty
  6.  *    driver and an interface between it and a pseudo-device.
  7.  *
  8.  * Copyright 1987, 1989 Regents of the University of California
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any purpose and without
  11.  * fee is hereby granted, provided that the above copyright
  12.  * notice appear in all copies.  The University of California
  13.  * makes no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without
  15.  * express or implied warranty.
  16.  *
  17.  * $Header: /sprite/src/lib/include/RCS/td.h,v 1.7 90/09/11 14:39:48 kupfer Exp $ SPRITE (Berkeley)
  18.  */
  19.  
  20. #ifndef _TD
  21. #define _TD
  22.  
  23. #include <sprite.h>
  24. #include <fmt.h>
  25.  
  26. typedef struct Td_Terminal *Td_Terminal;
  27. typedef struct Td_Pdev *Td_Pdev;
  28.  
  29. /*
  30.  * Command arguments to Td_ControlRaw:
  31.  */
  32.  
  33. #define TD_BREAK        1
  34. #define TD_GOT_CARRIER        2
  35. #define TD_LOST_CARRIER        3
  36.  
  37. /*
  38.  * Command arguments to the device's raw control procedure:
  39.  */
  40.  
  41. #define TD_RAW_START_BREAK    1
  42. #define TD_RAW_STOP_BREAK    2
  43. #define TD_RAW_SET_DTR        3
  44. #define TD_RAW_CLEAR_DTR    4
  45. #define TD_RAW_SHUTDOWN        5
  46. #define TD_RAW_OUTPUT_READY    6
  47. #define TD_RAW_FLUSH_OUTPUT    7
  48. #define TD_RAW_FLOW_CHARS    8
  49. #define TD_RAW_SET_BAUD_RATE    9
  50. #define TD_RAW_GET_BAUD_RATE    10
  51.  
  52. /*
  53.  * Data structure passed from the terminal driver to the raw
  54.  * control procedure for TD_RAW_FLOW_CHARS:
  55.  */
  56.  
  57. typedef struct {
  58.     char stop;            /* Character to stop output to raw
  59.                  * terminal;  -1 means no stop character. */
  60.     char start;            /* Character to restart output to raw
  61.                  * terminal;  -1 means no start character. */
  62. } Td_FlowChars;
  63.  
  64. /*
  65.  * Data structure passed from the terminal driver to the raw
  66.  * control procedure for TD_RAW_SET_BAUD_RATE and TD_RAW_GET_BAUD_RATE:
  67.  */
  68.  
  69. typedef struct {
  70.     char ispeed;        /* New input baud rate for terminal
  71.                  * (B9600, etc.). */
  72.     char ospeed;        /* New output baud rate for terminal
  73.                  * (B9600, etc.). */
  74. } Td_BaudRate;
  75.  
  76. /*
  77.  * Command arguments for the cooked control procedure:
  78.  */
  79.  
  80. #define TD_COOKED_SIGNAL    21
  81. #define TD_COOKED_READS_OK    22
  82. #define TD_COOKED_WRITES_OK    23
  83.  
  84. /*
  85.  * Data structure passed from the terminal driver to the cooked
  86.  * control procedure for TD_COOKED_SIGNAL:
  87.  */
  88.  
  89. typedef struct {
  90.     int sigNum;            /* Signal number to generate. */
  91.     int groupID;        /* ID of controlling process group
  92.                  * for terminal. */
  93. } Td_Signal;
  94.  
  95. /*
  96.  * Exported procedures:
  97.  */
  98.  
  99. extern Td_Terminal 
  100.     Td_Create _ARGS_((int bufferSize,
  101.               int (*cookedProc)_ARGS_((ClientData, int operation,
  102.                            int inBufSize, char *inBuffer,
  103.                            int outBufSize,
  104.                            char *outBuffer)),
  105.               ClientData cookedData,
  106.               int (*rawProc)_ARGS_((ClientData, int operation,
  107.                         int inBufSize, char *inBuffer,
  108.                         int outBufSize, char *outBuffer)),
  109.               ClientData rawData));
  110. extern void Td_Delete _ARGS_((Td_Terminal terminal));
  111. extern int Td_Open _ARGS_((Td_Terminal terminal, int *selectBitsPtr));
  112. extern void Td_Close _ARGS_((Td_Terminal terminal));
  113. extern int Td_GetCooked _ARGS_((Td_Terminal terminal, int pID, int familyID,
  114.     int *numCharsPtr, char *buffer, int *sigNumPtr, int *selectBitsPtr));
  115. extern int Td_PutCooked _ARGS_((Td_Terminal terminal, int *numBytesPtr,
  116.     register char *buffer, int *sigNumPtr, int *selectBitsPtr));
  117. extern int Td_ControlCooked _ARGS_((Td_Terminal terminal, int command,
  118.     Fmt_Format format, int inputSize, char *input, int *outputSizePtr,
  119.     char *output, int *sigNumPtr, int *selectBitsPtr));
  120. extern int Td_GetRaw _ARGS_((Td_Terminal terminal, int numChars,
  121.     register char *buffer));
  122. extern void Td_PutRaw _ARGS_((Td_Terminal terminal,
  123.     int numChars, char *buffer));
  124. extern void Td_ControlRaw _ARGS_((Td_Terminal terminal, int operation));
  125.  
  126. extern Td_Pdev Td_CreatePdev _ARGS_((char *name, char **realNamePtr,
  127.     Td_Terminal *termPtr, int (*rawProc)(), ClientData clientData));
  128. extern void Td_DeletePdev _ARGS_((Td_Pdev ttyPdev));
  129.  
  130. #endif /* _TD */
  131.